package com.snowballtech.retry;

import com.aliyun.openservices.shade.io.netty.util.internal.StringUtil;

/**
 * Description: 监控机器人消息
 *
 * @Author: genezhao
 * @Date: 2018-04-17
 */
public class MonitorMessage {

    /**
     * 发送给 @
     */
    private String to;

    private String serverEnv;

    private String serverName;

    private String msg;

    private String desc;

    public String getTo() {
        if (StringUtil.isNullOrEmpty(this.to)) {
            return "";
        }
        return to;
    }

    public MonitorMessage setTo(String to) {
        this.to = to;
        return this;
    }

    public String getServerEnv() {
        if (StringUtil.isNullOrEmpty(this.serverEnv)) {
            return "";
        }
        return serverEnv;
    }

    public MonitorMessage setServerEnv(String serverEnv) {
        this.serverEnv = serverEnv;
        return this;
    }

    public String getServerName() {
        if (StringUtil.isNullOrEmpty(this.serverName)) {
            return "";
        }
        return serverName;
    }

    public MonitorMessage setServerName(String serverName) {
        this.serverName = serverName;
        return this;
    }

    public String getMsg() {
        if (StringUtil.isNullOrEmpty(this.msg)) {
            return "";
        }
        return msg;
    }

    public MonitorMessage setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public String getDesc() {
        if (StringUtil.isNullOrEmpty(this.desc)) {
            return "请收到消息后及时查看该异常信息，以更好的改进服务，使服务的质量得到进一步的提高，谢谢！";
        }
        return desc;
    }

    public MonitorMessage setDesc(String desc) {
        this.desc = desc;
        return this;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("");
        sb.append("@").append(getTo()).append("\n");
        sb.append("服务器环境：").append(getServerEnv()).append("\n");
        sb.append("服务器名称：").append(getServerName()).append("\n");
        sb.append("异常信息：").append(getMsg()).append("\n");
        sb.append(getDesc());
        return sb.toString();
    }
}
